import 'package:flutter/material.dart';
import 'package:flutter_mvc_example/common/res.dart';

import 'view.dart';
import 'package:flutter_mvc/flutter_mvc.dart';

///Description:楼层市场
///Author:teihideharu
///date created 2021/04/29
class Market1Controller extends BaseController {
  ScrollController leftScrollController = ScrollController();
  Market1Controller() : super(Market1Page());
  int leftIndex = 0;
  double topMargin=0;
  double leftSelectHeight=52.dp;
  double leftSelectTop=0.dp;
  @override
  void initState() {
    super.initState();
    leftScrollController.addListener(onScrollListener);
  }

  void onScrollListener() {
    topMargin=-leftScrollController.offset;
    setState();
  }

  final h44= 44.dp;
  final h60= 60.dp;
  final h8= 8.dp;
  final h52= 52.dp;
  void onLeftItemClick(int index) {
    this.leftIndex=index;
    if (leftIndex > 0) {
      leftSelectTop = leftIndex *h44 - h8;
      leftSelectHeight=h60;
    }else {
      leftSelectTop = 0;
      leftSelectHeight =h52;
    }

    if(leftSelectTop==20-1){

      leftSelectHeight =h52;
    }

    setState();
  }
}
